using System;
using System.Text;
using System.Data;
using System.Collections;
using System.Collections.Generic;

using Framework;

namespace SchemaMonitor
{
    //Table-Row Class (Customisable half)
    public partial class CImageMatchedButDifferent
    {
        #region Constants
        #endregion

        #region Constructors (Public)
        //Default Connection String
        public CImageMatchedButDifferent() : base() {}
        public CImageMatchedButDifferent(Guid mD5, Guid matchingMd5) : base(mD5, matchingMd5) {}
        
        //Alternative Connection String
        public CImageMatchedButDifferent(CDataSrc dataSrc) : base(dataSrc) {}
        public CImageMatchedButDifferent(CDataSrc dataSrc, Guid mD5, Guid matchingMd5) : base(dataSrc, mD5, matchingMd5) {}
        
        //Transactional (shares an open connection)
        protected internal CImageMatchedButDifferent(CDataSrc dataSrc, Guid mD5, Guid matchingMd5, IDbTransaction txOrNull) : base(dataSrc, mD5, matchingMd5, txOrNull) {}        
        #endregion

        #region Default Values
        protected override void InitValues_Custom()
        {
            //Custom default values (e.g. DateCreated column)
            //Member variables (e.g. for child collections)
        }
        #endregion
        
        #region Default Connection String
        protected override CDataSrc DefaultDataSrc()  { return CConfig.Photos;  }
        #endregion
        
        #region Members
        //Foreign Keys
        
        //Child Collections
        
        //Xml Data (as high-level objects)
        
        #endregion

        #region Properties - Relationships
        //Relationships - Foriegn Keys (e.g parent)
        
        //Relationships - Collections (e.g. children)
        
        #endregion

        #region Properties - Customisation
         //Derived/ReadOnly (e.g. xml classes, presentation logic)
        #endregion

        #region Save/Delete Overrides
        //Can Override base.Save/Delete (e.g. Cascade deletes, or insert related records)
        #endregion

        #region Custom Database Queries
        //For Stored Procs can use: MakeList (matching schema), or DataSrc.ExecuteDataset (reports etc)
        //For Dynamic sql, can use: SelectSum, SelectDistinct, SelectCount, SelectWhere (inherited methods)
        //                see also: SelectBy[FK], Search and Count (auto-generated sample queries)
        #endregion

        #region Cloning
        public CImageMatchedButDifferent Clone(CDataSrc target, IDbTransaction txOrNull) //, int parentId)
        {
            //Shallow copy: Copies the immediate record, excluding autogenerated Pks
            CImageMatchedButDifferent copy = new CImageMatchedButDifferent(this, target);

            //Deep Copy - Child Entities: Cloned children must reference their cloned parent
            //copy.SampleParentId = parentId;

            copy.Save(txOrNull);

            //Deep Copy - Parent Entities: Cloned parents also clone their child collections
            //this.Children.Clone(target, txOrNull, copy.MD5);

            return copy;
        }
        #endregion

        #region ToXml
        protected override void ToXml_Custom(System.Xml.XmlWriter w)
        {
            //Store(w, "Example", this.Example)
        }
        #endregion
    }
}